[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
settextjustify() Set Current Text Justification Settings
#include <graphics.h>
void far settextjustify(horiz,vert);
int horiz;
int vert;
settextjustify() controls text justification with respect to the
current position (CP). The text is justified horizontally and
vertically. Constants of the text_just enumeration type (defined in
<graphics.h>) for 'horiz' and 'vert' are:
Name Value Description
LEFT_TEXT 0 horiz
CENTER_TEXT 1 horiz and vert
RIGHT_TEXT 2 horiz
BOTTOM_TEXT 0 vert
TOP_TEXT 2 vert
The default value for 'horiz' is LEFT_TEXT and for 'vert' is
TOP_TEXT. All text output using outtext() and outtextxy() will be
affected after a call to settextjustify().
Returns: Nothing. If coded, graphresult() will return -11 (generic
graphics error) if invalid input is passed. The current
text justification setting remains the same.
-------------------------------- Example ---------------------------------
The following statements set four different text fonts, along with
text direction and text justification and output the font name.
#include <graphics.h>
#include <conio.h>
main()
{
int gdriver = DETECT;
int gmode;
struct textsettingstype textset;
initgraph(&gdriver,&gmode,"");
gettextsettings(&textset);
settextstyle(GOTHIC_FONT,HORIZ_DIR,3);
settextjustify(LEFT_TEXT,TOP_TEXT);
outtextxy(300,150,"Gothic Font");
settextstyle(TRIPLEX_FONT,VERT_DIR,3);
settextjustify(RIGHT_TEXT,BOTTOM_TEXT);
outtextxy(300,150,"Triplex Font");
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,3);
settextjustify(RIGHT_TEXT,BOTTOM_TEXT);
outtextxy(250,150,"Sans-serif Font");
settextstyle(SMALL_FONT,VERT_DIR,4);
settextjustify(CENTER_TEXT,TOP_TEXT);
outtextxy(300,200,"Very Small Font");
getch();
closegraph();
}
See Also:
gettextsettings()
settextstyle()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson